package com.cross.apps.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {

	@CrossOrigin(origins= {"*"},allowedHeaders= {"*"},methods=RequestMethod.GET)
	@RequestMapping(value="/a",method=RequestMethod.GET)
	public Map<String,Object> a(String name) {
		Map<String,Object> result=new HashMap<>();
		result.put("result", "success");
		result.put("code", 200);
		result.put("name", name);
		result.put("msg", "成功了!");
		return result;
	}
	@CrossOrigin(origins= {"*"},methods=RequestMethod.POST)
	@RequestMapping(value="/post",method=RequestMethod.POST)
	public Map<String,Object> testPost(String name,String pwd){
		System.out.println(name);
		System.out.println(pwd);
		Map<String,Object> result=new HashMap<>();
		result.put("result", "success");
		result.put("code",200);
		result.put("name", name);
		result.put("pwd", pwd);
		return  result;
	}
}
